package com.kb.controller.iems;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import com.kb.dto.iems.OrderBomErrorDetailRecordReplyDTO;
import com.kb.service.EngineeringService;
import com.kb.vo.iems.EmailOrderBomDetailErrorRecordVO;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/engineer")
@Api(value = "元器件 通用类", tags = {"元器件 通用类"})
@Slf4j
@RequiredArgsConstructor
public class EngineeringController {

    private final EngineeringService engineeringService;

    @Operation(summary = "邮件异常记录明细查询")
    @GetMapping("/open/email/detail/{id}")
    @ResponseBody
    public CommonResult<EmailOrderBomDetailErrorRecordVO> queryEmailOrderBomDetailErrorRecordVO(@PathVariable String id) {
        return CommonResult.success(engineeringService.queryEmailOrderBomDetailErrorRecordVO(id));
    }

    @Operation(summary = "异常记录回复")
    @PostMapping("/open/email/reply")
    @ResponseBody
    public CommonResult<Boolean> replyEmailOrderBomDetailErrorRecord(@RequestBody OrderBomErrorDetailRecordReplyDTO dto) {
        return CommonResult.success(engineeringService.replyOrderBomDetailErrorRecord(dto));
    }
}
